﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

using SpiritAlight.Character;
using SpiritAlight.Stage;
using SpiritAlight.SceneManagement;
using SpiritAlight.Scene;

namespace SpiritAlight.Character.Unit.EntityEnemy
{
    class Goblin : AEnemy
    {
        static private Texture2D[,] texture = new Texture2D[4,3];

        static UnitStatus status = new UnitStatus();


        protected override UnitStatus Status
        {
            get { return status; }
            set { status = value; }
        }

        public Goblin(Vector2 inPosition)
            :base()
        {
            Position = inPosition;
            Initialize();
        }

        public Goblin(float inX, float inY)
            :base()
        {
            Position = new Vector2(inX, inY);
            Initialize();
        }

        /// <summary>
        /// ロード完了フラグ
        /// </summary>
        public override bool IsLoaded
        {
            get { return isLoaded; }
            protected set
            {
                if (!isLoaded)
                    isLoaded = value;
            }
        }
        static bool isLoaded = false;

        public override void Initialize()
        {
            
            //ユニットステータス初期化
            Status.Size = new Vector2(80.0f, 120.0f);
            Status.AttackInterval = 100;
            Status.HitPoint = 50;
            Status.Power = 1;
            Status.RangeAttackOperation = 0.0f;
            Status.RangeSearchOperation = 0.0f;

            base.Initialize();
        }

        public override void LoadContent()
        {
            if (IsLoaded)
                return;

            texture[(int)Direction.Up, (int)CharacterState.Wait] = SceneManager.Content.Load<Texture2D>("Character/Enemy/Goblin/front");
            texture[(int)Direction.Down, (int)CharacterState.Wait] = SceneManager.Content.Load<Texture2D>("Character/Enemy/Goblin/back");
            texture[(int)Direction.Left, (int)CharacterState.Wait] = SceneManager.Content.Load<Texture2D>("Character/Enemy/Goblin/left");
            texture[(int)Direction.Right, (int)CharacterState.Wait] = SceneManager.Content.Load<Texture2D>("Character/Enemy/Goblin/right");
            

            base.LoadContent();
        }

        public override void Update()
        {
            base.Update();
        }

        public override void Draw()
        {
            GameMain.DrawObject(texture[(Int32)Direction, (Int32)State], Position - Camera.Position);
        }
    }
}
